<template>
    <fieldset>
        <legend>购物车</legend>
        <ul>
            <li v-for="item in msg" :key="item.id">
                <b>商品名称：{{item.title}}</b>
                ----
                <b>商品价格:{{item.price}}</b>
                ----
                <b>购买数量:{{item.count}}</b>
                ----
                <button @click="DELETEMSGS(item)">-</button>
                <button @click="ADDMSGS(item)" :disabled="item.count===item.inventory">+加购一件</button>
            </li>
        </ul>
        <!-- <button @click="aaa">aaa</button> -->
        <div>总价:{{TOTAL}}</div>
    </fieldset>
</template>
<script>
import { mapState,mapGetters,mapActions } from 'vuex';
    export default{
        computed: {
            ...mapState('packages',['msg']),
            ...mapGetters('packages',['TOTAL'])
        },
        methods: {
            ...mapActions('packages',['DELETEMSGS']),
            ...mapActions('packages',['ADDMSGS']),
            // aaa(){
            //     console.log(this.msg);
            // }
        }
        
    }



</script>